{% extends "repo/repo.html" %}
{% block subcontainer %}
<div class="issue-form inner bubble">
  <h2 class="heading">修改问题</h2>
  {% if error %}
  <div class="alert">
    <a data-dismiss="alert" class="close"><i class="icon-remove"></i></a>
    <p><strong>出错了！</strong>{{ error }}</p>
  </div>
  {% endif %}
  <form class="form" method="post">
    {% csrf_token %}
    <div class="fields"><span class="group"><b>分配给</b>{{ issueForm.assigned }}{{ issueForm.tracker }}{{ issueForm.status }}{{ issueForm.priority }}</span><span class="group"><b>类别</b>{{ issueForm.category }}</span></div>
    <div class="fields">{{ issueForm.subject }}</div>
    <div class="fields">{{ issueForm.content }}</div>
    <div class="actions">
      <button id="iSubmit" class="btn btn-primary" type="submit">确定</button>
      <button id="iDelete" class="btn btn-danger">删除</button>
    </div>
  </form>
</div>
{% endblock %}
{% block subjs %}
<script>
  $(function(){
    $('#iDelete').click(function(){
      var text = $(this).text();
      if(text == '删除') {
        $(this).text('确定删除');
      }
      if(text == '确定删除') {
        $.post('/{{user_name}}/{{repo_name}}/issues/delete/{{issue_id}}/', {csrfmiddlewaretoken: '{{ csrf_token }}'}, function(json){
          window.location = '/{{user_name}}/{{repo_name}}/issues/'
        });
      }
      return false;
    });
    $('#id_subject').attr('placeholder', '标题');
    $('#id_content').attr('placeholder', '问题描述');
    $('#id_category').attr('placeholder', '优化，安全...');
  });
</script>
{% endblock %}


